Skip to main content

Git Hooks Setup Verification

This project uses Husky and lint-staged to automatically lint and format code on every commit.

Verify Your Setup

After cloning the repository and running npm install, verify that Git hooks are properly configured:

npm run check:hooks

Expected Output (Success)

Checking Git Hooks Setup...

✓ .husky directory exists
✓ pre-commit hook exists
✓ Git hooks path is configured correctly
✓ Husky is installed
✓ lint-staged is installed

All Git hooks are properly configured!
Automatic linting and formatting will run on every commit.

If Setup Failed

If you see any errors, run:

npm install
npx husky install

Then verify again with npm run check:hooks.

What This Does

When you commit code, the pre-commit hook auto-fixes format and lint:

  1. Prettier (npm run format:fix) — formats all packages (ts, tsx, js, jsx, json, css, md)
  2. ESLint (npm run lint:fix) — fixes auto-fixable lint issues in packages/frontend, packages/backend, packages/shared

If either command fails (e.g. unfixable lint errors), the commit is blocked. Fixes are applied to your files before the commit completes, so what gets committed should pass CI.

In rare cases where you need to bypass the pre-commit hook:

git commit --no-verify -m "your message"

Note: This should only be used in exceptional circumstances, as it skips code quality checks.